package controllers;

import java.util.ArrayList;
import java.util.List;

import common.FBSecure;

import play.mvc.Controller;
import play.mvc.With;
import sun.security.action.GetBooleanAction;
import models.Comment;
import models.CommentEpisode;
import models.CommentSerie;
import models.CommentTopic;
import models.CommentVideo;
import models.Serie;
import models.Topic;
import models.User;
import models.Video;

@With(FBSecure.class)
public class MyProfile extends FBController{


	public static void myprofile(){

		setFbIdandName();

		User user = getUser();
		
		List<Serie> serieList = user.getFollows();
		List<Topic> topicList = user.getTopicList();

		render(user, serieList, topicList );
	}
	
	public static void myprofile_comments(){

		setFbIdandName();

		User user = getUser();
		
		List<Serie> serieList = user.getFollows();
		List<Comment> commentList = user.getComments();
		
		List<CommentEpisode> commentEpisodeList = new ArrayList<CommentEpisode>();
		List<CommentSerie> commentSerieList = new ArrayList<CommentSerie>();
		List<CommentTopic> commentTopicList = new ArrayList<CommentTopic>();
		List<CommentVideo> commentVideoList = new ArrayList<CommentVideo>();
		
		for (Comment comment : commentList) {
			
			if(comment instanceof CommentEpisode) {
				commentEpisodeList.add((CommentEpisode) comment);				
			}
			else if (comment instanceof CommentSerie){
				commentSerieList.add((CommentSerie) comment);
			}
			else if (comment instanceof CommentTopic){
				commentTopicList.add((CommentTopic) comment);
			}
			else if (comment instanceof CommentVideo){
				commentVideoList.add((CommentVideo) comment);
			}
		}
		

		render(user, serieList, commentEpisodeList, commentSerieList, commentTopicList, commentVideoList );
	}

	public static void myprofile_videos(){

		setFbIdandName();

		User user = getUser();
		
		List<Serie> serieList = user.getFollows();
		List<Video> videoList = user.getVideoList();
		render(user, serieList, videoList );
	}	
	


	// Arkadaşlarına öner olacak

	
}
